/*
 * Copyright 2017 Baiyyy
 * @(#)WorkingState.java
 */

package com.byyy.ccts.modules.ysjl.enums;

/**
 * 工作状态枚举
 */
public enum ActivityCateEnum  implements EnumInterface  {

    ACTIVITY(1, "群活动", ""),
    // background: linear-gradient(135deg,white,#d8e8f8,#d8e8f8);
    PROMOTION(2, "等级晋级赛", "background: linear-gradient(135deg,#292A23,#536976,#536976,#292A23);"),
    COMPETITION(3, "正式比赛", "background: linear-gradient(135deg,#020202,#EDB65B,#020202);"),
    ;
    private int code;
    private String msg;
    private String style;

    private ActivityCateEnum(int code, String msg, String style) {
        this.code = code;
        this.msg = msg;
        this.style = style;
    }

    public static ActivityCateEnum getEnumByCode(int code) {
        for (ActivityCateEnum c : values()) {
            if (c.getCode() == code) {
                return c;
            }
        }
        return null;
    }

    public static String getMsgByCode(int code) {
        for (ActivityCateEnum c : values()) {
            if (c.getCode() == code) {
                return c.getMsg();
            }
        }
        return null;
    }

    public static String getStyleByCode(int code) {
        for (ActivityCateEnum c : values()) {
            if (c.getCode() == code) {
                return c.getStyle();
            }
        }
        return null;
    }

    /**
     * getByMsg
     *
     */
    public static ActivityCateEnum getByMsg(String msg) {
        for (ActivityCateEnum c : values()) {
            if (c.msg.equals(msg)) {
                return c;
            }
        }
        return null;
    }

    public static Integer getCodeByMsg(String msg) {
        for (ActivityCateEnum c : ActivityCateEnum.values()) {
            if (c.msg.equals(msg)) {
                return c.code;
            }
        }
        return null;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public String getStyle() {
        return style;
    }

    public String getKey() {
        return this.name();
    }
}
